﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		TagUrlBuilder.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 // 
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion

using System;
using Dexter.CallContext;
using Dexter.Domain.Model;
using Dexter.Logger.Contracts;

namespace Dexter.Services.Implementation {
	/// <summary>
	/// 	Implementation of <see cref = "ITagUrlBuilder" />:
	/// </summary>
	public class TagUrlBuilder : UrlBuilderBase , ITagUrlBuilder {
		/// <summary>
		/// 	Initializes a new instance of the <see cref = "TagUrlBuilder" /> class.
		/// </summary>
		/// <param name = "logger">The logger.</param>
		/// <param name = "context">The HTTP context.</param>
		/// <param name = "configurationService">The configuration service.</param>
		public TagUrlBuilder ( ILogger logger , IDexterContext context , IConfigurationService configurationService ) : base ( logger , context , configurationService ) {}

		/// <summary>
		/// 	Return the detail url of the specified <see cref = "TagItem" />.
		/// </summary>
		/// <param name = "tag">The tag.</param>
		/// <example>
		/// 	http://dexterblogengine.com/Tags/Archive/My-Tag/
		/// </example>
		public virtual string Detail ( TagItem tag ) {
			string dt = string.Format ( "Tag/Archive/{0}/" , tag.Name );
			return ToCaseConfiguration ( new Uri ( HomePage , dt ) );
		}

		/// <summary>
		/// 	Return the detail url of the specified <see cref = "TagItem" />.
		/// </summary>
		/// <param name = "tag">The tag.</param>
		/// <example>
		/// 	http://dexterblogengine.com/Tags/Archive/My-Tag/
		/// </example>
		public virtual string Detail ( string tag ) {
			string dt = string.Format ( "Tag/Archive/{0}/" , tag );
			return ToCaseConfiguration ( new Uri ( HomePage , dt ) );
		}
	}
}
